#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[200005],b[200005],lg[200005],st_a[200005][18],st_b[200005][18];
inline int qa(int l,int r)
{
	int k=lg[r-l+1];
	return min(st_a[l][k],st_a[r-(1<<k)+1][k]);
}
inline int qb(int l,int r)
{
	int k=lg[r-l+1];
	return min(st_b[l][k],st_b[r-(1<<k)+1][k]);
}
mt19937 rnd(time(0));
signed main()
{
	for(int i=2;i<=200000;i++)
		lg[i]=lg[i>>1]+1;
	freopen("min.in","r",stdin);
	freopen("min.out","w",stdout);
	ios::sync_with_stdio(false);
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		st_a[i][0]=a[i];
	}
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		st_b[i][0]=b[i];
	}
	for(int j=1;j<=17;j++)
		for(int i=1;i+(1<<j)<=n+1;i++)
		{
			st_a[i][j]=min(st_a[i][j-1],st_a[i+(1<<(j-1))][j-1]);
			st_b[i][j]=min(st_b[i][j-1],st_b[i+(1<<(j-1))][j-1]);
		}
	for(int i=1;i<=n;i++)
	{
		int ans=INT_MAX;
		if(n<=10000)
		{
			for(int j=i;j<=n;j++)
				ans=min(ans,abs(qa(j-i+1,j)-qb(j-i+1,j)));
		}
		else if(i<350)
		{
			for(int j=i;j<=n;j++)
				ans=min(ans,abs(qa(j-i+1,j)-qb(j-i+1,j)));
		}
		else
		{
			for(int _=1;_<=25;_++)
			{
				int j=rnd()%(n-i+1)+i;
				ans=min(ans,abs(qa(j-i+1,j)-qb(j-i+1,j)));
			}
		}
		cout<<ans<<'\n';
	}
	return 0;
}
